<include file="Common/header" />
<link rel="stylesheet" href="__PUBLIC__/css/login.css" />
    <div class="container">

            <form class="form-signin myform card" method="post" action="server/index.php?s=/api/item/pwd">
        <h3 class="form-signin-heading heading">{$Think.Lang.input_visit_password}</h3>
        <input type="hidden" id="item_id" name="item_id" value="{$item_id}">
        <input type="password" class="input-block-level" name="password" placeholder="{$Think.Lang.password}">
        <input type="hidden"  name="refer_url" value="{$refer_url}">
        <if  condition="$CloseVerify != 1">
        <input type="text" class="input-block-level" id="input_v_code" name="v_code" placeholder="{$Think.Lang.verification_code}">
              <div class="control-group">
          <div class="controls">
            <img src="" id="v_code_img">
          </div>
        </div>
        </if>
        <button class="btn btn-large btn-primary btn-block" type="submit">{$Think.Lang.submit}</button>
     
        <div class="form-group" style="text-align:center;margin-top:15px;">
            <a href="{:U('Home/User/login')}">{$Think.Lang.login_or_register}</a>
        </div>
         </form>
    </div> <!-- /container -->


<include file="Common/footer" />
<script src="__PUBLIC__/js/jquery.form.min.js"></script>
 <script type="text/javascript">
 $(function(){
    $("#input_v_code").hide();
    $("#v_code_img").hide();
    $("#v_code_img").attr("src" , DocConfig.pubile+'/verifyCode.php');

    $("#v_code_img").click(function(){
      var v_code_img = $("#v_code_img").attr("src");
      $("#v_code_img").attr('src' ,v_code_img+'?'+Date.parse(new Date()) );
    }); 

    //上传表单参数
    var ajax_option = {
      dataType:"json",
      beforeSubmit:function(){

      },
      success:function(res){
        if (res.error_code === 0) {
          if (res.refer_url) {
            var url = res.refer_url;
          }else{
            var url = '?s=/'+$("#item_id").val();
          }
          window.location.href = url;
        }else{
          $.alert(res.error_message);

          if (res.error_code === 10206 || res.error_code === 10308 ) {
            $("#v_code_img").click();
            $("#v_code_img").show();
            $("#input_v_code").show();
          };
          
        }
      }
    };

    $('.myform').ajaxForm(ajax_option); 
 });
</script>

